In recent years in the U.S., problems associated with opioid prescriptions, including non-medical use and overdose, increased to historically unprecedented levels and represent a public health crisis. Emergency departments (EDs) play an important role in opioid prescribing, particularly to individuals at high risk for adverse opioi-related outcomes. Half of all ED visits are for a painful condition, and one third of all ED visits result in an opioid being prescribed. Moreover, in our pilot work, a quarter of patients surveyed at the ED study site reported non-medical opioid use in the prior three months. Despite the importance of this problem, strategies to reduce non-medical opioid use after an ED visit have not been well-studied. Our recent trial of a motivational intervention delivered to patients in the ED by a therapist resulted in modest reductions in non- medical use after the ED visit compared to a control condition. However, the intervention was unable to address the implications of opioids prescribed as a result of the ED encounter on post-ED opioid use behavior. This project will adapt the intervention for delivery after the ED visit through mobile technology in order to directly address the use of ED-provided opioids. Patients (n=600) will be recruited during an ED visit for a randomized controlled trial of the adapted intervention based on having used opioids non-medically in the prior three months and being given an opioid by an ED prescriber. In the intervention condition, interactive voice response calls will repeatedly assess non-medical opioid use and pain level and deliver intervention content. The intervention will include several potential actions that vary in intensity: assessment only, a brief message, extended messaging, or connection to a therapist by phone. Because the most helpful intensity of intervention is unknown and likely to vary between patients, the project will use an artificial intelligence stratey called reinforcement learning (RL). The RL system will continuously learn from the success of prior actions in similar situations with similar patients in order to select the action most likelyto reduce non-medical opioid use for each participant during each call. The RCT will be complemented by qualitative interviews to inform later implementation. The specific aims are to: (1) Adapt and enhance an existing motivational intervention to decrease non-medical opioid use after an ED visit by optimizing intervention intensity and duration through RL; (2) Examine the impact of the intervention on non-medical opioid use level during the six months post-ED visit; (3) Examine the impact of the intervention on driving after opioid use, overdose risk behaviors, and subsequent opioid-related ED visits. Secondary Aims are: (1) to examine differences in intervention effects between participants with high and low baseline levels of non-medical opioid use; and (2) to understand barriers and facilitators of implementation. This project will use a highly innovative strategy, artificial intelligence, to address a highly significant problem, non-medical opioid use. Ultimately, this study can lead to reductions in opioid- related harms and move forward the field of mobile health.